// Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package endpoints

import (
	"encoding/json"
	"fmt"
	"testing"
)

type SonarKey struct {
	Value  string `json:"value"`
	Label  string `json:"label"`
	Domain string `json:"domain"`
}

type SonarMetricKey struct {
	ID            string `json:"id"`
	MetricKey     string `json:"key"`
	ValueType     string `json:"type"`
	Name          string `json:"name"`
	MetricKeyDesc string `json:"description"`
	Domain        string `json:"domain"`
	Operational   int    `json:"direction"`
	Qualitative   bool   `json:"qualitative"`
	Hidden        bool   `json:"hidden"`
	Custom        bool   `json:"custom"`
	DecimalScale  int    `json:"decimalScale"`
}

func Test_sonarKey(t *testing.T) {
	var onOverallCode = "[{\"value\":\"<domain>\",\"label\":\"Complexity\",\"disabled\":true},{\"value\":\"cognitive_complexity\",\"label\":\"Cognitive Complexity\",\"domain\":\"Complexity\"},{\"value\":\"complexity\",\"label\":\"Cyclomatic Complexity\",\"domain\":\"Complexity\"},{\"value\":\"<domain>\",\"label\":\"Coverage\",\"disabled\":true},{\"value\":\"branch_coverage\",\"label\":\"Condition Coverage\",\"domain\":\"Coverage\"},{\"value\":\"conditions_to_cover\",\"label\":\"Conditions to Cover\",\"domain\":\"Coverage\"},{\"value\":\"coverage\",\"label\":\"Coverage\",\"domain\":\"Coverage\"},{\"value\":\"line_coverage\",\"label\":\"Line Coverage\",\"domain\":\"Coverage\"},{\"value\":\"lines_to_cover\",\"label\":\"Lines to Cover\",\"domain\":\"Coverage\"},{\"value\":\"skipped_tests\",\"label\":\"Skipped Unit Tests\",\"domain\":\"Coverage\"},{\"value\":\"uncovered_conditions\",\"label\":\"Uncovered Conditions\",\"domain\":\"Coverage\"},{\"value\":\"uncovered_lines\",\"label\":\"Uncovered Lines\",\"domain\":\"Coverage\"},{\"value\":\"test_execution_time\",\"label\":\"Unit Test Duration\",\"domain\":\"Coverage\"},{\"value\":\"test_errors\",\"label\":\"Unit Test Errors\",\"domain\":\"Coverage\"},{\"value\":\"test_failures\",\"label\":\"Unit Test Failures\",\"domain\":\"Coverage\"},{\"value\":\"test_success_density\",\"label\":\"Unit Test Success (%)\",\"domain\":\"Coverage\"},{\"value\":\"tests\",\"label\":\"Unit Tests\",\"domain\":\"Coverage\"},{\"value\":\"<domain>\",\"label\":\"Duplications\",\"disabled\":true},{\"value\":\"duplicated_blocks\",\"label\":\"Duplicated Blocks\",\"domain\":\"Duplications\"},{\"value\":\"duplicated_files\",\"label\":\"Duplicated Files\",\"domain\":\"Duplications\"},{\"value\":\"duplicated_lines\",\"label\":\"Duplicated Lines\",\"domain\":\"Duplications\"},{\"value\":\"duplicated_lines_density\",\"label\":\"Duplicated Lines (%)\",\"domain\":\"Duplications\"},{\"value\":\"<domain>\",\"label\":\"Issues\",\"disabled\":true},{\"value\":\"blocker_violations\",\"label\":\"Blocker Issues\",\"domain\":\"Issues\"},{\"value\":\"confirmed_issues\",\"label\":\"Confirmed Issues\",\"domain\":\"Issues\"},{\"value\":\"critical_violations\",\"label\":\"Critical Issues\",\"domain\":\"Issues\"},{\"value\":\"false_positive_issues\",\"label\":\"False Positive Issues\",\"domain\":\"Issues\"},{\"value\":\"info_violations\",\"label\":\"Info Issues\",\"domain\":\"Issues\"},{\"value\":\"violations\",\"label\":\"Issues\",\"domain\":\"Issues\"},{\"value\":\"major_violations\",\"label\":\"Major Issues\",\"domain\":\"Issues\"},{\"value\":\"minor_violations\",\"label\":\"Minor Issues\",\"domain\":\"Issues\"},{\"value\":\"open_issues\",\"label\":\"Open Issues\",\"domain\":\"Issues\"},{\"value\":\"reopened_issues\",\"label\":\"Reopened Issues\",\"domain\":\"Issues\"},{\"value\":\"wont_fix_issues\",\"label\":\"Won't Fix Issues\",\"domain\":\"Issues\"},{\"value\":\"<domain>\",\"label\":\"Maintainability\",\"disabled\":true},{\"value\":\"code_smells\",\"label\":\"Code Smells\",\"domain\":\"Maintainability\"},{\"value\":\"effort_to_reach_maintainability_rating_a\",\"label\":\"Effort to Reach Maintainability Rating A\",\"domain\":\"Maintainability\"},{\"value\":\"sqale_rating\",\"label\":\"Maintainability Rating\",\"domain\":\"Maintainability\"},{\"value\":\"sqale_index\",\"label\":\"Technical Debt\",\"domain\":\"Maintainability\"},{\"value\":\"sqale_debt_ratio\",\"label\":\"Technical Debt Ratio\",\"domain\":\"Maintainability\"},{\"value\":\"<domain>\",\"label\":\"Management\",\"disabled\":true},{\"value\":\"burned_budget\",\"label\":\"Burned budget\",\"domain\":\"Management\"},{\"value\":\"business_value\",\"label\":\"Business value\",\"domain\":\"Management\"},{\"value\":\"team_size\",\"label\":\"Team size\",\"domain\":\"Management\"},{\"value\":\"<domain>\",\"label\":\"Reliability\",\"disabled\":true},{\"value\":\"bugs\",\"label\":\"Bugs\",\"domain\":\"Reliability\"},{\"value\":\"reliability_rating\",\"label\":\"Reliability Rating\",\"domain\":\"Reliability\"},{\"value\":\"reliability_remediation_effort\",\"label\":\"Reliability Remediation Effort\",\"domain\":\"Reliability\"},{\"value\":\"<domain>\",\"label\":\"Security\",\"disabled\":true},{\"value\":\"security_rating\",\"label\":\"Security Rating\",\"domain\":\"Security\"},{\"value\":\"security_remediation_effort\",\"label\":\"Security Remediation Effort\",\"domain\":\"Security\"},{\"value\":\"vulnerabilities\",\"label\":\"Vulnerabilities\",\"domain\":\"Security\"},{\"value\":\"<domain>\",\"label\":\"Security Review\",\"disabled\":true},{\"value\":\"security_hotspots_reviewed\",\"label\":\"Security Hotspots Reviewed\",\"domain\":\"SecurityReview\"},{\"value\":\"security_review_rating\",\"label\":\"Security Review Rating\",\"domain\":\"SecurityReview\"},{\"value\":\"<domain>\",\"label\":\"Size\",\"disabled\":true},{\"value\":\"classes\",\"label\":\"Classes\",\"domain\":\"Size\"},{\"value\":\"comment_lines\",\"label\":\"Comment Lines\",\"domain\":\"Size\"},{\"value\":\"comment_lines_density\",\"label\":\"Comments (%)\",\"domain\":\"Size\"},{\"value\":\"directories\",\"label\":\"Directories\",\"domain\":\"Size\"},{\"value\":\"files\",\"label\":\"Files\",\"domain\":\"Size\"},{\"value\":\"functions\",\"label\":\"Functions\",\"domain\":\"Size\"},{\"value\":\"generated_lines\",\"label\":\"Generated Lines\",\"domain\":\"Size\"},{\"value\":\"generated_ncloc\",\"label\":\"Generated Lines of Code\",\"domain\":\"Size\"},{\"value\":\"lines\",\"label\":\"Lines\",\"domain\":\"Size\"},{\"value\":\"ncloc\",\"label\":\"Lines of Code\",\"domain\":\"Size\"},{\"value\":\"projects\",\"label\":\"Projects\",\"domain\":\"Size\"},{\"value\":\"statements\",\"label\":\"Statements\",\"domain\":\"Size\"}]"
	var codes []SonarKey
	err := json.Unmarshal([]byte(onOverallCode), &codes)
	if err != nil {
		fmt.Println(err)
		t.Fail()
	}

	var allCode = "[{\"id\":\"AXX1Ay01PNZ8ut5f3Kaa\",\"key\":\"new_technical_debt\",\"type\":\"WORK_DUR\",\"name\":\"Added Technical Debt\",\"description\":\"Added technical debt\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0rPNZ8ut5f3KaB\",\"key\":\"blocker_violations\",\"type\":\"INT\",\"name\":\"Blocker Issues\",\"description\":\"Blocker issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0zPNZ8ut5f3KaT\",\"key\":\"bugs\",\"type\":\"INT\",\"name\":\"Bugs\",\"description\":\"Bugs\",\"domain\":\"Reliability\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1GPNZ8ut5f3Ka5\",\"key\":\"burned_budget\",\"type\":\"FLOAT\",\"name\":\"Burned budget\",\"domain\":\"Management\",\"direction\":0,\"qualitative\":false,\"hidden\":false,\"custom\":true,\"decimalScale\":1},{\"id\":\"AXX1Ay1GPNZ8ut5f3Ka6\",\"key\":\"business_value\",\"type\":\"FLOAT\",\"name\":\"Business value\",\"domain\":\"Management\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":true,\"decimalScale\":1},{\"id\":\"AXX1Ay0JPNZ8ut5f3KZQ\",\"key\":\"classes\",\"type\":\"INT\",\"name\":\"Classes\",\"description\":\"Classes\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0zPNZ8ut5f3KaR\",\"key\":\"code_smells\",\"type\":\"INT\",\"name\":\"Code Smells\",\"description\":\"Code Smells\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0XPNZ8ut5f3KZj\",\"key\":\"cognitive_complexity\",\"type\":\"INT\",\"name\":\"Cognitive Complexity\",\"description\":\"Cognitive complexity\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0NPNZ8ut5f3KZX\",\"key\":\"comment_lines\",\"type\":\"INT\",\"name\":\"Comment Lines\",\"description\":\"Number of comment lines\",\"domain\":\"Size\",\"direction\":1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0NPNZ8ut5f3KZY\",\"key\":\"comment_lines_density\",\"type\":\"PERCENT\",\"name\":\"Comments (%)\",\"description\":\"Comments balanced by ncloc + comment lines\",\"domain\":\"Size\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay1CPNZ8ut5f3Kaz\",\"key\":\"comment_lines_data\",\"type\":\"DATA\",\"name\":\"comment_lines_data\",\"domain\":\"Size\",\"direction\":0,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0WPNZ8ut5f3KZe\",\"key\":\"class_complexity\",\"type\":\"FLOAT\",\"name\":\"Complexity / Class\",\"description\":\"Complexity average by class\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":true,\"hidden\":true,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0VPNZ8ut5f3KZc\",\"key\":\"file_complexity\",\"type\":\"FLOAT\",\"name\":\"Complexity / File\",\"description\":\"Complexity average by file\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":true,\"hidden\":true,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0WPNZ8ut5f3KZg\",\"key\":\"function_complexity\",\"type\":\"FLOAT\",\"name\":\"Complexity / Function\",\"description\":\"Complexity average by function\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":true,\"hidden\":true,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0VPNZ8ut5f3KZd\",\"key\":\"complexity_in_classes\",\"type\":\"INT\",\"name\":\"Complexity in Classes\",\"description\":\"Cyclomatic complexity in classes\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0WPNZ8ut5f3KZf\",\"key\":\"complexity_in_functions\",\"type\":\"INT\",\"name\":\"Complexity in Functions\",\"description\":\"Cyclomatic complexity in functions\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0lPNZ8ut5f3KZ2\",\"key\":\"branch_coverage\",\"type\":\"PERCENT\",\"name\":\"Condition Coverage\",\"description\":\"Condition coverage\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0mPNZ8ut5f3KZ3\",\"key\":\"new_branch_coverage\",\"type\":\"PERCENT\",\"name\":\"Condition Coverage on New Code\",\"description\":\"Condition coverage of new/changed code\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0hPNZ8ut5f3KZy\",\"key\":\"conditions_to_cover\",\"type\":\"INT\",\"name\":\"Conditions to Cover\",\"description\":\"Conditions to cover\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0jPNZ8ut5f3KZz\",\"key\":\"new_conditions_to_cover\",\"type\":\"INT\",\"name\":\"Conditions to Cover on New Code\",\"description\":\"Conditions to cover on new code\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0yPNZ8ut5f3KaQ\",\"key\":\"confirmed_issues\",\"type\":\"INT\",\"name\":\"Confirmed Issues\",\"description\":\"Confirmed issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0cPNZ8ut5f3KZq\",\"key\":\"coverage\",\"type\":\"PERCENT\",\"name\":\"Coverage\",\"description\":\"Coverage by tests\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0cPNZ8ut5f3KZr\",\"key\":\"new_coverage\",\"type\":\"PERCENT\",\"name\":\"Coverage on New Code\",\"description\":\"Coverage of new/changed code\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0sPNZ8ut5f3KaC\",\"key\":\"critical_violations\",\"type\":\"INT\",\"name\":\"Critical Issues\",\"description\":\"Critical issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0VPNZ8ut5f3KZb\",\"key\":\"complexity\",\"type\":\"INT\",\"name\":\"Cyclomatic Complexity\",\"description\":\"Cyclomatic complexity\",\"domain\":\"Complexity\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1FPNZ8ut5f3Ka4\",\"key\":\"last_commit_date\",\"type\":\"MILLISEC\",\"name\":\"Date of Last Commit\",\"domain\":\"SCM\",\"direction\":0,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay02PNZ8ut5f3Kad\",\"key\":\"development_cost\",\"type\":\"STRING\",\"name\":\"Development Cost\",\"description\":\"Development cost\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay04PNZ8ut5f3Kae\",\"key\":\"new_development_cost\",\"type\":\"FLOAT\",\"name\":\"Development Cost on New Code\",\"description\":\"Development cost on new code\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":true,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0LPNZ8ut5f3KZS\",\"key\":\"directories\",\"type\":\"INT\",\"name\":\"Directories\",\"description\":\"Directories\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0nPNZ8ut5f3KZ6\",\"key\":\"duplicated_blocks\",\"type\":\"INT\",\"name\":\"Duplicated Blocks\",\"description\":\"Duplicated blocks\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0oPNZ8ut5f3KZ7\",\"key\":\"new_duplicated_blocks\",\"type\":\"INT\",\"name\":\"Duplicated Blocks on New Code\",\"description\":\"Duplicated blocks on new code\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0pPNZ8ut5f3KZ8\",\"key\":\"duplicated_files\",\"type\":\"INT\",\"name\":\"Duplicated Files\",\"description\":\"Duplicated files\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0mPNZ8ut5f3KZ4\",\"key\":\"duplicated_lines\",\"type\":\"INT\",\"name\":\"Duplicated Lines\",\"description\":\"Duplicated lines\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0qPNZ8ut5f3KZ9\",\"key\":\"duplicated_lines_density\",\"type\":\"PERCENT\",\"name\":\"Duplicated Lines (%)\",\"description\":\"Duplicated lines balanced by statements\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0qPNZ8ut5f3KZ-\",\"key\":\"new_duplicated_lines_density\",\"type\":\"PERCENT\",\"name\":\"Duplicated Lines (%) on New Code\",\"description\":\"Duplicated lines (%) on new code balanced by statements\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0nPNZ8ut5f3KZ5\",\"key\":\"new_duplicated_lines\",\"type\":\"INT\",\"name\":\"Duplicated Lines on New Code\",\"description\":\"Duplicated Lines on New Code\",\"domain\":\"Duplications\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0qPNZ8ut5f3KZ_\",\"key\":\"duplications_data\",\"type\":\"DATA\",\"name\":\"Duplication Details\",\"description\":\"Duplications details\",\"domain\":\"Duplications\",\"direction\":0,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay05PNZ8ut5f3Kah\",\"key\":\"effort_to_reach_maintainability_rating_a\",\"type\":\"WORK_DUR\",\"name\":\"Effort to Reach Maintainability Rating A\",\"description\":\"Effort to reach maintainability rating A\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1CPNZ8ut5f3Ka0\",\"key\":\"executable_lines_data\",\"type\":\"DATA\",\"name\":\"executable_lines_data\",\"domain\":\"Coverage\",\"direction\":0,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0xPNZ8ut5f3KaM\",\"key\":\"false_positive_issues\",\"type\":\"INT\",\"name\":\"False Positive Issues\",\"description\":\"False positive issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0XPNZ8ut5f3KZi\",\"key\":\"file_complexity_distribution\",\"type\":\"DISTRIB\",\"name\":\"File Distribution / Complexity\",\"description\":\"Files distribution /complexity\",\"domain\":\"Complexity\",\"direction\":0,\"qualitative\":true,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0KPNZ8ut5f3KZR\",\"key\":\"files\",\"type\":\"INT\",\"name\":\"Files\",\"description\":\"Number of files\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0XPNZ8ut5f3KZh\",\"key\":\"function_complexity_distribution\",\"type\":\"DISTRIB\",\"name\":\"Function Distribution / Complexity\",\"description\":\"Functions distribution /complexity\",\"domain\":\"Complexity\",\"direction\":0,\"qualitative\":true,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0LPNZ8ut5f3KZT\",\"key\":\"functions\",\"type\":\"INT\",\"name\":\"Functions\",\"description\":\"Functions\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0BPNZ8ut5f3KZL\",\"key\":\"generated_lines\",\"type\":\"INT\",\"name\":\"Generated Lines\",\"description\":\"Number of generated lines\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0HPNZ8ut5f3KZP\",\"key\":\"generated_ncloc\",\"type\":\"INT\",\"name\":\"Generated Lines of Code\",\"description\":\"Generated non Commenting Lines of Code\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0tPNZ8ut5f3KaF\",\"key\":\"info_violations\",\"type\":\"INT\",\"name\":\"Info Issues\",\"description\":\"Info issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0rPNZ8ut5f3KaA\",\"key\":\"violations\",\"type\":\"INT\",\"name\":\"Issues\",\"description\":\"Issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0ePNZ8ut5f3KZw\",\"key\":\"line_coverage\",\"type\":\"PERCENT\",\"name\":\"Line Coverage\",\"description\":\"Line coverage\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0fPNZ8ut5f3KZx\",\"key\":\"new_line_coverage\",\"type\":\"PERCENT\",\"name\":\"Line Coverage on New Code\",\"description\":\"Line coverage of added/changed code\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0APNZ8ut5f3KZK\",\"key\":\"lines\",\"type\":\"INT\",\"name\":\"Lines\",\"description\":\"Lines\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0CPNZ8ut5f3KZM\",\"key\":\"ncloc\",\"type\":\"INT\",\"name\":\"Lines of Code\",\"description\":\"Non commenting lines of code\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0EPNZ8ut5f3KZO\",\"key\":\"ncloc_language_distribution\",\"type\":\"DATA\",\"name\":\"Lines of Code Per Language\",\"description\":\"Non Commenting Lines of Code Distributed By Language\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0dPNZ8ut5f3KZs\",\"key\":\"lines_to_cover\",\"type\":\"INT\",\"name\":\"Lines to Cover\",\"description\":\"Lines to cover\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0dPNZ8ut5f3KZt\",\"key\":\"new_lines_to_cover\",\"type\":\"INT\",\"name\":\"Lines to Cover on New Code\",\"description\":\"Lines to cover on new code\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay02PNZ8ut5f3Kab\",\"key\":\"sqale_rating\",\"type\":\"RATING\",\"name\":\"Maintainability Rating\",\"description\":\"A-to-E rating based on the technical debt ratio\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay02PNZ8ut5f3Kac\",\"key\":\"new_maintainability_rating\",\"type\":\"RATING\",\"name\":\"Maintainability Rating on New Code\",\"description\":\"Maintainability rating on new code\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0sPNZ8ut5f3KaD\",\"key\":\"major_violations\",\"type\":\"INT\",\"name\":\"Major Issues\",\"description\":\"Major issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0sPNZ8ut5f3KaE\",\"key\":\"minor_violations\",\"type\":\"INT\",\"name\":\"Minor Issues\",\"description\":\"Minor issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1CPNZ8ut5f3Kay\",\"key\":\"ncloc_data\",\"type\":\"DATA\",\"name\":\"ncloc_data\",\"domain\":\"Size\",\"direction\":0,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0uPNZ8ut5f3KaH\",\"key\":\"new_blocker_violations\",\"type\":\"INT\",\"name\":\"New Blocker Issues\",\"description\":\"New Blocker issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay00PNZ8ut5f3KaU\",\"key\":\"new_bugs\",\"type\":\"INT\",\"name\":\"New Bugs\",\"description\":\"New Bugs\",\"domain\":\"Reliability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0zPNZ8ut5f3KaS\",\"key\":\"new_code_smells\",\"type\":\"INT\",\"name\":\"New Code Smells\",\"description\":\"New Code Smells\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0uPNZ8ut5f3KaI\",\"key\":\"new_critical_violations\",\"type\":\"INT\",\"name\":\"New Critical Issues\",\"description\":\"New Critical issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0xPNZ8ut5f3KaL\",\"key\":\"new_info_violations\",\"type\":\"INT\",\"name\":\"New Info Issues\",\"description\":\"New Info issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0uPNZ8ut5f3KaG\",\"key\":\"new_violations\",\"type\":\"INT\",\"name\":\"New Issues\",\"description\":\"New issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0CPNZ8ut5f3KZN\",\"key\":\"new_lines\",\"type\":\"INT\",\"name\":\"New Lines\",\"description\":\"New lines\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0wPNZ8ut5f3KaJ\",\"key\":\"new_major_violations\",\"type\":\"INT\",\"name\":\"New Major Issues\",\"description\":\"New Major issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0xPNZ8ut5f3KaK\",\"key\":\"new_minor_violations\",\"type\":\"INT\",\"name\":\"New Minor Issues\",\"description\":\"New Minor issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay01PNZ8ut5f3KaY\",\"key\":\"new_security_hotspots\",\"type\":\"INT\",\"name\":\"New Security Hotspots\",\"description\":\"New Security Hotspots\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay00PNZ8ut5f3KaW\",\"key\":\"new_vulnerabilities\",\"type\":\"INT\",\"name\":\"New Vulnerabilities\",\"description\":\"New Vulnerabilities\",\"domain\":\"Security\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0yPNZ8ut5f3KaO\",\"key\":\"open_issues\",\"type\":\"INT\",\"name\":\"Open Issues\",\"description\":\"Open issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1FPNZ8ut5f3Ka3\",\"key\":\"quality_profiles\",\"type\":\"DATA\",\"name\":\"Profiles\",\"description\":\"Details of quality profiles used during analysis\",\"domain\":\"General\",\"direction\":0,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0MPNZ8ut5f3KZW\",\"key\":\"projects\",\"type\":\"INT\",\"name\":\"Projects\",\"description\":\"Number of projects\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0MPNZ8ut5f3KZV\",\"key\":\"public_api\",\"type\":\"INT\",\"name\":\"Public API\",\"description\":\"Public API\",\"domain\":\"Documentation\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0PPNZ8ut5f3KZZ\",\"key\":\"public_documented_api_density\",\"type\":\"PERCENT\",\"name\":\"Public Documented API (%)\",\"description\":\"Public documented classes and functions balanced by ncloc\",\"domain\":\"Documentation\",\"direction\":1,\"qualitative\":true,\"hidden\":true,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0UPNZ8ut5f3KZa\",\"key\":\"public_undocumented_api\",\"type\":\"INT\",\"name\":\"Public Undocumented API\",\"description\":\"Public undocumented classes, functions and variables\",\"domain\":\"Documentation\",\"direction\":-1,\"qualitative\":true,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay1DPNZ8ut5f3Ka2\",\"key\":\"quality_gate_details\",\"type\":\"DATA\",\"name\":\"Quality Gate Details\",\"description\":\"The project detailed status with regard to its quality gate\",\"domain\":\"General\",\"direction\":0,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1DPNZ8ut5f3Ka1\",\"key\":\"alert_status\",\"type\":\"LEVEL\",\"name\":\"Quality Gate Status\",\"description\":\"The project status with regard to its quality gate.\",\"domain\":\"Releasability\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay07PNZ8ut5f3Kak\",\"key\":\"reliability_rating\",\"type\":\"RATING\",\"name\":\"Reliability Rating\",\"description\":\"Reliability rating\",\"domain\":\"Reliability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay08PNZ8ut5f3Kal\",\"key\":\"new_reliability_rating\",\"type\":\"RATING\",\"name\":\"Reliability Rating on New Code\",\"description\":\"Reliability rating on new code\",\"domain\":\"Reliability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay06PNZ8ut5f3Kai\",\"key\":\"reliability_remediation_effort\",\"type\":\"WORK_DUR\",\"name\":\"Reliability Remediation Effort\",\"description\":\"Reliability Remediation Effort\",\"domain\":\"Reliability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay07PNZ8ut5f3Kaj\",\"key\":\"new_reliability_remediation_effort\",\"type\":\"WORK_DUR\",\"name\":\"Reliability Remediation Effort on New Code\",\"description\":\"Reliability remediation effort on new code\",\"domain\":\"Reliability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0yPNZ8ut5f3KaP\",\"key\":\"reopened_issues\",\"type\":\"INT\",\"name\":\"Reopened Issues\",\"description\":\"Reopened issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay01PNZ8ut5f3KaX\",\"key\":\"security_hotspots\",\"type\":\"INT\",\"name\":\"Security Hotspots\",\"description\":\"Security Hotspots\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0_PNZ8ut5f3Kas\",\"key\":\"security_hotspots_reviewed\",\"type\":\"PERCENT\",\"name\":\"Security Hotspots Reviewed\",\"description\":\"Percentage of Security Hotspots Reviewed\",\"domain\":\"SecurityReview\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay1APNZ8ut5f3Kat\",\"key\":\"new_security_hotspots_reviewed\",\"type\":\"PERCENT\",\"name\":\"Security Hotspots Reviewed on New Code\",\"description\":\"Percentage of Security Hotspots Reviewed on New Code\",\"domain\":\"SecurityReview\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay09PNZ8ut5f3Kao\",\"key\":\"security_rating\",\"type\":\"RATING\",\"name\":\"Security Rating\",\"description\":\"Security rating\",\"domain\":\"Security\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay09PNZ8ut5f3Kap\",\"key\":\"new_security_rating\",\"type\":\"RATING\",\"name\":\"Security Rating on New Code\",\"description\":\"Security rating on new code\",\"domain\":\"Security\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay08PNZ8ut5f3Kam\",\"key\":\"security_remediation_effort\",\"type\":\"WORK_DUR\",\"name\":\"Security Remediation Effort\",\"description\":\"Security remediation effort\",\"domain\":\"Security\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay08PNZ8ut5f3Kan\",\"key\":\"new_security_remediation_effort\",\"type\":\"WORK_DUR\",\"name\":\"Security Remediation Effort on New Code\",\"description\":\"Security remediation effort on new code\",\"domain\":\"Security\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0-PNZ8ut5f3Kaq\",\"key\":\"security_review_rating\",\"type\":\"RATING\",\"name\":\"Security Review Rating\",\"description\":\"Security Review Rating\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0_PNZ8ut5f3Kar\",\"key\":\"new_security_review_rating\",\"type\":\"RATING\",\"name\":\"Security Review Rating on New Code\",\"description\":\"Security Review Rating on New Code\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1APNZ8ut5f3Kau\",\"key\":\"security_hotspots_reviewed_status\",\"type\":\"INT\",\"name\":\"Security Review Reviewed Status\",\"description\":\"Security Review Reviewed Status\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay1BPNZ8ut5f3Kaw\",\"key\":\"new_security_hotspots_reviewed_status\",\"type\":\"INT\",\"name\":\"Security Review Reviewed Status on New Code\",\"description\":\"Security Review Reviewed Status on New Code\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay1APNZ8ut5f3Kav\",\"key\":\"security_hotspots_to_review_status\",\"type\":\"INT\",\"name\":\"Security Review To Review Status\",\"description\":\"Security Review To Review Status\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay1CPNZ8ut5f3Kax\",\"key\":\"new_security_hotspots_to_review_status\",\"type\":\"INT\",\"name\":\"Security Review To Review Status on New Code\",\"description\":\"Security Review To Review Status on New Code\",\"domain\":\"SecurityReview\",\"direction\":-1,\"qualitative\":false,\"hidden\":true,\"custom\":false},{\"id\":\"AXX1Ay0aPNZ8ut5f3KZn\",\"key\":\"skipped_tests\",\"type\":\"INT\",\"name\":\"Skipped Unit Tests\",\"description\":\"Number of skipped unit tests\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0MPNZ8ut5f3KZU\",\"key\":\"statements\",\"type\":\"INT\",\"name\":\"Statements\",\"description\":\"Number of statements\",\"domain\":\"Size\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay1HPNZ8ut5f3Ka7\",\"key\":\"team_size\",\"type\":\"INT\",\"name\":\"Team size\",\"domain\":\"Management\",\"direction\":0,\"qualitative\":false,\"hidden\":false,\"custom\":true},{\"id\":\"AXX1Ay01PNZ8ut5f3KaZ\",\"key\":\"sqale_index\",\"type\":\"WORK_DUR\",\"name\":\"Technical Debt\",\"description\":\"Total effort (in hours) to fix all the issues on the component and therefore to comply to all the requirements.\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay04PNZ8ut5f3Kaf\",\"key\":\"sqale_debt_ratio\",\"type\":\"PERCENT\",\"name\":\"Technical Debt Ratio\",\"description\":\"Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay04PNZ8ut5f3Kag\",\"key\":\"new_sqale_debt_ratio\",\"type\":\"PERCENT\",\"name\":\"Technical Debt Ratio on New Code\",\"description\":\"Technical Debt Ratio of new/changed code.\",\"domain\":\"Maintainability\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0jPNZ8ut5f3KZ0\",\"key\":\"uncovered_conditions\",\"type\":\"INT\",\"name\":\"Uncovered Conditions\",\"description\":\"Uncovered conditions\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0lPNZ8ut5f3KZ1\",\"key\":\"new_uncovered_conditions\",\"type\":\"INT\",\"name\":\"Uncovered Conditions on New Code\",\"description\":\"Uncovered conditions on new code\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0ePNZ8ut5f3KZu\",\"key\":\"uncovered_lines\",\"type\":\"INT\",\"name\":\"Uncovered Lines\",\"description\":\"Uncovered lines\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0ePNZ8ut5f3KZv\",\"key\":\"new_uncovered_lines\",\"type\":\"INT\",\"name\":\"Uncovered Lines on New Code\",\"description\":\"Uncovered lines on new code\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0ZPNZ8ut5f3KZl\",\"key\":\"test_execution_time\",\"type\":\"MILLISEC\",\"name\":\"Unit Test Duration\",\"description\":\"Execution duration of unit tests\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0ZPNZ8ut5f3KZm\",\"key\":\"test_errors\",\"type\":\"INT\",\"name\":\"Unit Test Errors\",\"description\":\"Number of unit test errors\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0bPNZ8ut5f3KZo\",\"key\":\"test_failures\",\"type\":\"INT\",\"name\":\"Unit Test Failures\",\"description\":\"Number of unit test failures\",\"domain\":\"Coverage\",\"direction\":-1,\"qualitative\":true,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0bPNZ8ut5f3KZp\",\"key\":\"test_success_density\",\"type\":\"PERCENT\",\"name\":\"Unit Test Success (%)\",\"description\":\"Density of successful unit tests\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":true,\"hidden\":false,\"custom\":false,\"decimalScale\":1},{\"id\":\"AXX1Ay0ZPNZ8ut5f3KZk\",\"key\":\"tests\",\"type\":\"INT\",\"name\":\"Unit Tests\",\"description\":\"Number of unit tests\",\"domain\":\"Coverage\",\"direction\":1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay00PNZ8ut5f3KaV\",\"key\":\"vulnerabilities\",\"type\":\"INT\",\"name\":\"Vulnerabilities\",\"description\":\"Vulnerabilities\",\"domain\":\"Security\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false},{\"id\":\"AXX1Ay0yPNZ8ut5f3KaN\",\"key\":\"wont_fix_issues\",\"type\":\"INT\",\"name\":\"Won't Fix Issues\",\"description\":\"Won't fix issues\",\"domain\":\"Issues\",\"direction\":-1,\"qualitative\":false,\"hidden\":false,\"custom\":false}]"
	var allCodes []SonarMetricKey
	err = json.Unmarshal([]byte(allCode), &allCodes)
	if err != nil {
		fmt.Println(err)
		t.Fail()
	}

	var onOverallCodes []SonarMetricKey
	for _, v := range allCodes {
		for _, code := range codes {
			if code.Value == v.MetricKey {
				onOverallCodes = append(onOverallCodes, v)
				break
			}
		}
	}

	var str = "insert into qa_sonar_metric_keys (id,metric_key, value_type, name, metric_key_desc, domain, operational, qualitative, hidden, custom, decimal_scale) values \n"

	for index, v := range onOverallCodes {
		str += fmt.Sprintf("(%d,'%s', '%s', '%s', '%s', '%s', %v, %v, %v, %v, %v),",
			index+1, v.MetricKey, v.ValueType, v.Name, v.MetricKeyDesc, v.Domain, v.Operational, v.Qualitative, v.Hidden, v.Custom, v.DecimalScale) + "\n"
	}
	fmt.Println(str)

}
